export default {
    created(){
      if(this.$store.state.username==null){
        this.$router.push({ path: '/login' })
        }
    },
    methods:{
        bind(e){
            // console.log(e)
            this.$store.commit("moveCar")
            this.$store.state.shopingList[e].car_num-=1
            if(this.$store.state.shopingList[e].car_num==0){
                this.$store.state.shopingList.splice(e,1)
            }
            // console.log(this.$store.state.shopingList)
        },
        clearcar(){
            this.$store.state.car_num_all=0
            this.$store.state.shopingList=[]
            for(let i=0;i<this.$store.state.list.length;i++){
                this.$store.state.list[i].car_num=0
            }
        }
    }
}